Hello,
pragma runLim, 0
Skip EngAttrList = create()
Skip IVVAttrList = create()
Skip EngUserGroup = create()
Skip IVVUserGroup = create()
//Engineering Attributes
put(EngAttrList, "Object Text", "Object Text")
put(EngAttrList, "Object Short Text", "Object Short Text")
put(EngAttrList, "Object Heading", "Object Heading")
put(EngAttrList, "_1E Req", "_1E Req")
put(EngAttrList, "_Comments", "_Comments")
put(EngAttrList, "_Criticality", "_Criticality")
put(EngAttrList, "_Level 2 Req", "_Level 2 Req")
put(EngAttrList, "_NC Req", "_NC Req")
put(EngAttrList, "_NC+ Req", "_NC+ Req")
put(EngAttrList, "_Remarks", "_Remarks")
put(EngAttrList, "_Req Eval", "_Req Eval")
put(EngAttrList, "_Req Type", "_Req Type")
//Engineering UserGroup
put(EngUserGroup, "Engineering Lead", "Engineering Lead")
put(EngUserGroup, "Application Engineer", "Application Engineer")
put(EngUserGroup, "Hardware Engineer", "Hardware Engineer")
put(EngUserGroup, "CNCS Engineer", "CNCS Engineer")
put(EngUserGroup, "1E Engineer", "1E Engineer")
//IV&V Attributes
put(IVVAttrList, "_IV&V ASW Req", "_IV&V ASW Req")
put(IVVAttrList, "_IV&V Comments", "_IV&V Comments")
put(IVVAttrList, "_IV&V Feasible", "_IV&V Feasible")
put(IVVAttrList, "_IV&V Remarks", "_IV&V Remarks")
put(IVVAttrList, "_IV&V Testable", "_IV&V Testable")
//IV&V UserGroup
put(IVVUserGroup, "IV&V Lead", "IV&V Lead")
put(IVVUserGroup, "IV&V Engineer", "IV&V Engineer")
/**********************************
unsetAllDefVal
***********************************/
void unsetAllDefVal(Module m, Skip List1)
{
string attr = null
string err = null
AttrDef ad
for attr in List1 do
{
ad = find(m, attr)
if(!null ad)
{
err = unsetAllDef(m, ad)
if (!null err) print err
err = unsetAllVal(m, ad)
if (!null err) print err
}
}
}
/**********************************
setAttrDefVal
***********************************/
void setAttrDefVal(Module m, Skip List1, Skip List2)
{
string attr = null
string err = null
string usergroup = null
AttrDef ad
for attr in List1 do
{
ad = find(m, attr)
if(!null ad)
{
usergroup = null
for usergroup in List2 do
{
err = setDef(m, ad, read, usergroup)
if (!null err) print err
err = setVal(m, ad, read|modify, usergroup)
if (!null err) print err
}
}
}
}
/**********************************
scanModule
***********************************/
void scanModule(Item itm)
{
Module thisModule = null
string mName = fullName(itm)
thisModule = edit(mName, false,true)
if (!null thisModule)
{
unsetAllDefVal(thisModule, EngAttrList)
unsetAllDefVal(thisModule, IVVAttrList)
setAttrDefVal(thisModule, EngAttrList, EngUserGroup)
setAttrDefVal(thisModule, IVVAttrList, IVVUserGroup)
}
if (!null thisModule)
{
save(thisModule)
close(thisModule)
}
}
/*********************************
scanFolder
**********************************/
void scanFolder(Folder f)
{
Item itm
for itm in f do
{
if (null itm) continue
if (isDeleted(itm)) continue
if ((type (itm) == "Project") || (type (itm) == "Folder"))
{
scanFolder(folder(itm))
}
else if (type (itm) == "Formal")
{
scanModule(itm)
}
}
}
/************************************
MAIN
*************************************/
string currFolder = fullName current Folder
if (confirm("Lock[Attr] for " currFolder "?"))
{
scanFolder(folder currFolder)
delete EngAttrList
delete IVVAttrList
delete EngUserGroup
delete IVVUserGroup
// notify the user that the script is complete
ack "Complete."
}
SystemAdmin - Fri May 04 10:24:53 EDT 2012 |
Re: Locking down Attr (help needed) [] The "delete(skp) commands should unconditionally after the "if" statement, not inside it. [] I don't think you can "unset" unless the access is already "specific" (not "inherited"), so you'll need in the first function:
Otherwise, I didn't see anything wrong with the logic but something doesn't quite feel right .. with what you are trying to accomplish. -Louie |
Re: Locking down Attr (help needed) llandale - Sat May 05 16:51:50 EDT 2012
Otherwise, I didn't see anything wrong with the logic but something doesn't quite feel right .. with what you are trying to accomplish. -Louie -Jim |
Re: Locking down Attr (help needed) SystemAdmin - Sat May 05 21:11:45 EDT 2012 I think you are mixing paradigms; a group-centrix approach for some attributes and an attribute-centrix approach for the others. This is no disaster but it makes future modifications somewhat awkward. I think you should choose one of these: [1] For each attribute, which groups are allowed to modify values. 1a For each attribute assign it multi-enum "types"; then for each type assign Groups ... Types may be "Engineer" attribute, "IVV", "BookBoss" etc. [2] For each Group, which attributes they are allowed to modify. -Louie |